package com.sdhs.projectschedule.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.projectschedule.domain.GcProgressMasterPlanTemp;
import com.sdhs.projectschedule.service.IGcProgressMasterPlanTempService;

/**
 * 项目进度控制--总体计划管理-变更记录Controller
 * 
 * @author ww
 */
@RestController
@RequestMapping("/progress/masterPlanTemp")
public class GcProgressMasterPlanTempController extends BaseController
{
    @Autowired
    private IGcProgressMasterPlanTempService gcProgressMasterPlanTempService;

    /**
     * 查询总体计划-变更列表
     *
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlanTemp:list')")
    @GetMapping("/list")
    public AjaxResult listTemp(GcProgressMasterPlanTemp gcProgressMasterPlanTemp) {
        return success(gcProgressMasterPlanTempService.selectGcProgressMasterPlanTempTreeList(gcProgressMasterPlanTemp));
    }

    /**
     * 查询总体计划-变更
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlanTemp:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(gcProgressMasterPlanTempService.selectGcProgressMasterPlanTempById(id));
    }

    /**
     * 新增项目进度控制--总体计划管理-变更记录
     */
    @PreAuthorize("@ss.hasPermi('progress:masterPlanTemp:add')")
    @Log(title = "项目进度控制--总体计划管理-变更记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GcProgressMasterPlanTemp gcProgressMasterPlanTemp)
    {
        return success(gcProgressMasterPlanTempService.insertGcProgressMasterPlanTemp(gcProgressMasterPlanTemp));
    }
    
    @GetMapping(value = "/approvedCallback/{instanceId}")
    public AjaxResult approvedCallback(@PathVariable("instanceId") String instanceId)
    {
    	gcProgressMasterPlanTempService.approvedCallback(instanceId);
        return success();
    }
    
}






